package com.sluggard.security.manage.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sluggard.security.manage.model.entity.UserEntity;
import com.sluggard.security.manage.model.req.ChangeStatusReq;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 用户管理 Mapper 接口
 * </p>
 *
 * @author lizheng
 * @since 2024-04-28
 */
public interface UserMapper extends BaseMapper<UserEntity> {

    UserEntity selectByUsername(@Param("username") String username);

    UserEntity selectByUserId(@Param("userId") Long userId);

    Page<UserEntity> selectByPage(Page<UserEntity> page, @Param("ew") QueryWrapper<UserEntity> queryWrapper);

    List<UserEntity> selectListRelation( @Param("ew")  QueryWrapper<UserEntity> chainWrapper);

    void changeRole(@Param("userId") Long userId,@Param("roleId")  Long roleId);

    void changeStatus(@Param("req") ChangeStatusReq req);
}
